/**   
 * @Title: CancleTrackingCommunicater.java 
 * @Package: com.esun.rabbit2.communicaters.trackingrecord 
 * @Description: (取消追号接口) 
 * @Author: Billy qigs@500wan.com   
 * @Date: 2011-7-28 下午02:06:25  
 * Copyright (C) 2011 Shenzhen E-sun Sky Net Technology Co.,ltd.
 */
package com.esun.rabbit2.communicaters.trackingrecord;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;

import javax.xml.parsers.ParserConfigurationException;

import org.apache.http.client.ClientProtocolException;
import org.xml.sax.SAXException;

import com.esun.config.BussinessCode;
import com.esun.config.Key;
import com.esun.model.UserInfo;
import com.esun.network.ServerCommunicater;
import com.esun.util.log.EDebug;

/**
 * @ClassName: CancleTrackingCommunicater
 * @Description: (取消追号接口)
 * @Author: Billy qigs@500wan.com
 * @Date: 2011-7-28 下午02:06:25
 */
public class CancleTrackingCommunicater extends ServerCommunicater {

	private String USERSESSION = UserInfo.getUserInfo().getUserSession();
	private String msgServer;

	public void setMsgServer(String str) {
		this.msgServer = str;
	}

	public String getMsgServer() {
		return msgServer;
	}

	public boolean isCancleTracking(String lotid, String type, String pid) throws ClientProtocolException, IOException, ParserConfigurationException, SAXException {
		boolean isSucceed = false;

		ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
		list.add(mapItem(BussinessCode.PASER_MID, BussinessCode.MID_TRACKING_CANCLE));
		list.add(mapItem(BussinessCode.PASER_CK, USERSESSION));
		list.add(mapItem(Key.KEY_LOTID, lotid));
		list.add(mapItem(Key.KEY_TYPE, type));
		list.add(mapItem(Key.KEY_ZHID, pid));

		super.getServerResponse(list, true);
		setMsgServer(super.getErrorMSG());
		EDebug.o(this, super.getServerMsg());
		if (super.getState() == 100) {
			isSucceed = true;
		}

		return isSucceed;
	}

	private HashMap<String, String> mapItem(String name, String value) {
		HashMap<String, String> map = new HashMap<String, String>();
		map.put(name, value);
		return map;
	}
}
